# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=meld
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}3"
pkgver=3.11.1
pkgrel=0
pkgdesc="Visual diff and merge tool (mingw-w64)"
arch=('any')
url="http://meldmerge.org/"
license=("GPL" "LGPL")
options=('strip' 'staticlibs')
depends=(
        "${MINGW_PACKAGE_PREFIX}-gtk3"
        "${MINGW_PACKAGE_PREFIX}-libxml2"
        "${MINGW_PACKAGE_PREFIX}-python2-gobject"
        "${MINGW_PACKAGE_PREFIX}-gtksourceview3"
        "${MINGW_PACKAGE_PREFIX}-hicolor-icon-theme"
        "${MINGW_PACKAGE_PREFIX}-gsettings-desktop-schemas"
        )
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
            "${MINGW_PACKAGE_PREFIX}-pkg-config"
            'intltool'
            'itstool')
install=meld-${CARCH}.install
source=(http://ftp.gnome.org/pub/GNOME/sources/${_realname}/${pkgver%.*}/${_realname}-$pkgver.tar.xz
        '0001-fixes-for-MinGW-w64-symlinks-and-use-sh-to-spawn.patch')
md5sums=('3c657e2c7abb0907e299fad94cb31197'
         'b73b98e1fd12deffb9034a1522fb7f6c')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"
  patch -p1 -i "${srcdir}/0001-fixes-for-MinGW-w64-symlinks-and-use-sh-to-spawn.patch"
  sed -i 's/env python/env python2/' bin/meld
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"
  #export PYTHON=${MINGW_PREFIX}/bin/python2
  DISTUTILS_DEBUG=1 ${MINGW_PREFIX}/bin/python2 setup.py build 
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"

  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py --no-update-icon-cache --no-compile-schemas \
    install --prefix=${MINGW_PREFIX} --root="${pkgdir}"
}
